﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                exclude-result-prefixes="msxsl">
  <xsl:output method="html" indent="yes"/>

  <xsl:template match="Root/DocumentElement">
    <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match ="Item">
    <xsl:variable name="ProfilePicUrl">
      <xsl:value-of select="PersonProfileImageUrl" />
    </xsl:variable>
    <xsl:variable name="ProfilePicImage">
      <xsl:if test="$ProfilePicUrl = ''">/_layouts/images/O14_person_placeHolder_32.png</xsl:if>
      <xsl:if test="$ProfilePicUrl != ''">
        <xsl:value-of select="$ProfilePicUrl" />
      </xsl:if>
    </xsl:variable>
    <div class="activityItemContainer">
      <div class="activityImageContainer">
        <img src="{$ProfilePicImage}" alt="image" />
      </div>
      <div class="activityDetails">
        <div class="activitySummaryArea">
          <xsl:call-template name="InlinePresence">
            <xsl:with-param name="Email" select ="Email"/>
            <xsl:with-param name="ID" select="position()" />
          </xsl:call-template>
          <span calss="activitySummary">
            <xsl:value-of select ="ActivitySummary" disable-output-escaping ="yes"/>
          </span>
        </div>
        <div class="acitivityDate">
          <xsl:value-of select ="ActivityDate"/>
        </div>
      </div>
    </div>
  </xsl:template>
  <xsl:template name="InlinePresence" >
    <xsl:param name="Email" />
    <xsl:param name="ID" />
    <span class="presenceContainer">
      <img alt="MWP_pawn_{$Email}"
           src="/_layouts/images/imnhdr.gif"
           onload="IMNRC('{$Email}')"
           ShowOfflinePawn="1"
           id="{concat('MWP_pawn_', $Email, '_',$ID,'type=sip')}"  />
    </span>
  </xsl:template>

  <xsl:template match ="Root/ViewAllLink">
    <div class="activityFeedViewAllLink">
      <a>
        <xsl:attribute name ="href">
          <xsl:value-of select ="."/>
        </xsl:attribute>
        <xsl:value-of select ="'> View All Activities'"/>
      </a>
    </div>
  </xsl:template>

  <xsl:template match ="Root/NoResults">
    <div class="noResultsTextContainer">
      <span>
        <xsl:value-of select="." />
      </span>
    </div>
  </xsl:template>

  <xsl:template match ="Root/Error">
    <div class="noResultsTextContainer" style="color:Red">
      <span>
        <xsl:value-of select="." />
      </span>
    </div>
  </xsl:template>

</xsl:stylesheet>
